package com.zmn.plat.common.dictionary;

/**
 * 服务审核类型
 *
 * @author xiangjunming
 * @since 2019 /08/20 14:47:16
 */
public enum ChannelAuditTypeEnum {

    /**
     * values
     */
    DO_NOT_NEED_TO_REVIEW(ChannelAuditTypeEnum.ONE, "不需审核"),
    F_END_NEEDS_TO_BE_REVIEWED(ChannelAuditTypeEnum.TWO, "F端需审核"),
    QUALIFY_FOR_AUDIT(ChannelAuditTypeEnum.THREE, "保外审核"),
    AUDIT(ChannelAuditTypeEnum.FOUR, "均需审核"),
    ;

    /**
     * 渠道收款
     */
    public static final int ONE = 1;
    /**
     * 订单收入
     */
    public static final int TWO = 2;
    /**
     * 绩效基数金额
     */
    public static final int THREE = 3;
    /**
     * 外部价
     */
    public static final int FOUR = 4;

    private Integer code;
    private String name;

    ChannelAuditTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelAuditTypeEnum of(Integer code) {
        if (code == null || code == 0) {
            return null;
        }
        switch (code) {
            case 1:
                return DO_NOT_NEED_TO_REVIEW;
            case 2:
                return F_END_NEEDS_TO_BE_REVIEWED;
            case 3:
                return QUALIFY_FOR_AUDIT;
            case 4:
                return AUDIT;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelAuditTypeEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
